How can I simplify this calculation in Python for better readability

welcome to shbcf.ru